
 <!DOCTYPE HTML>
<html >
<head>
  <meta charset="UTF-8">
  
    <title>springboot之FailureAnalyzer | Typhoon&#39;s code space</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">
    
    <meta name="author" content="typhoon">
    

    
    <meta name="description" content="在这篇文章中，我们将探究springboot中的FailureAnalyzer(故障分析器),我们还将了解 在springboot应用中创建自定义FailureAnalyzer。">
<meta name="keywords" content="springboot">
<meta property="og:type" content="article">
<meta property="og:title" content="springboot之FailureAnalyzer">
<meta property="og:url" content="http://scorpioaeolus.oschina.io/2018/11/24/springboot之FailureAnalyzer/index.html">
<meta property="og:site_name" content="Typhoon&#39;s code space">
<meta property="og:description" content="在这篇文章中，我们将探究springboot中的FailureAnalyzer(故障分析器),我们还将了解 在springboot应用中创建自定义FailureAnalyzer。">
<meta property="og:updated_time" content="2018-11-24T12:44:05.913Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="springboot之FailureAnalyzer">
<meta name="twitter:description" content="在这篇文章中，我们将探究springboot中的FailureAnalyzer(故障分析器),我们还将了解 在springboot应用中创建自定义FailureAnalyzer。">

    
    <link rel="alternative" href="/atom.xml" title="Typhoon&#39;s code space" type="application/atom+xml">
    
    
    <link rel="icon" href="/typhoon/img/java.png">
    
    
    <link rel="apple-touch-icon" href="/typhoon/img/jacman.jpg">
    <link rel="apple-touch-icon-precomposed" href="/typhoon/img/jacman.jpg">
    
    <link rel="stylesheet" href="/typhoon/css/style.css">
</head>

  <body>
    <header>
      
<div>
		
			<div id="imglogo">
				<a href="/typhoon/"><img src="/typhoon/img/java.png" alt="Typhoon&#39;s code space" title="Typhoon&#39;s code space"/></a>
			</div>
			
			<div id="textlogo">
				<h1 class="site-name"><a href="/typhoon/" title="Typhoon&#39;s code space">Typhoon&#39;s code space</a></h1>
				<h2 class="blog-motto"></h2>
			</div>
			<div class="navbar"><a class="navbutton navmobile" href="#" title="Menu">
			</a></div>
			<nav class="animated">
				<ul>
					<ul>
					 
						<li><a href="/typhoon/">主页</a></li>
					
						<li><a href="/typhoon/archives">归档</a></li>
					
						<li><a href="/typhoon/about">关于</a></li>
					
					<li>
 					
					<form class="search" action="//google.com/search" method="get" accept-charset="utf-8">
						<label>Search</label>
						<input type="search" id="search" name="q" autocomplete="off" maxlength="20" placeholder="Search" />
						<input type="hidden" name="q" value="site:scorpioaeolus.oschina.io">
					</form>
					
					</li>
				</ul>
			</nav>			
</div>
    </header>
    <div id="container">
      <div id="main" class="post" itemscope itemprop="blogPost">
  
	<article itemprop="articleBody"> 
		<header class="article-info clearfix">
  <h1 itemprop="name">
    
      <a href="/typhoon/2018/11/24/springboot之FailureAnalyzer/" title="springboot之FailureAnalyzer" itemprop="url">springboot之FailureAnalyzer</a>
  </h1>
  <p class="article-author">By
       
		<a href="/typhoon/about" title="typhoon" target="_blank" itemprop="author">typhoon</a>
		
  <p class="article-time">
    <time datetime="2018-11-24T12:34:18.000Z" itemprop="datePublished"> Published 2018-11-24</time>
    
  </p>
</header>
	<div class="article-content">
		
		<div id="toc" class="toc-article">
			<strong class="toc-title">Contents</strong>
		
			<ol class="toc"><li class="toc-item toc-level-5"><a class="toc-link" href="#介绍"><span class="toc-number">1.</span> <span class="toc-text">介绍</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#1-创建自定义FailureAnalyzer"><span class="toc-number">2.</span> <span class="toc-text">1.创建自定义FailureAnalyzer</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#2-注册自定义FailureAnalyzer"><span class="toc-number">3.</span> <span class="toc-text">2.注册自定义FailureAnalyzer</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#3-FailureAnalyzer实际应用"><span class="toc-number">4.</span> <span class="toc-text">3.FailureAnalyzer实际应用</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#总结"><span class="toc-number">5.</span> <span class="toc-text">总结</span></a></li></ol>
		
		</div>
		
		<pre><code>    在这篇文章中，我们将探究springboot中的FailureAnalyzer(故障分析器),我们还将了解
在springboot应用中创建自定义FailureAnalyzer。
</code></pre><a id="more"></a>
<h5 id="介绍"><a href="#介绍" class="headerlink" title="介绍"></a>介绍</h5><pre><code>    大多数情况下，当我们在服务器启动时遇到异常时，我们需要非常仔细地分析，以便在尝试
修复它之前理解出什么问题。
    通过FailureAnalyzer，springboot提供了一种在启动时拦截异常的方法，并将它们转换为人性化的
格式（不必翻阅整个异常堆栈信息）。springboot自带了许多从应用程序上下文相关异常开始的FailureAnalyzer
故障分析器。    
    这里有一个例子，8080端口已经被使用，当我们试图在8080端口运行我们的springboot应用时，
PortInUseFailureAnalyzer截获这个异常并提供了一个更具可读性和用户友好的错误消息。    
</code></pre><figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">***************************</div><div class="line"></div><div class="line">APPLICATION FAILED TO START</div><div class="line"></div><div class="line">***************************</div><div class="line">Description:</div><div class="line">The Tomcat connector configured to listen on port <span class="number">8080</span> failed to start. The port may already be in use or the connector may be misconfigured.</div><div class="line">Action:</div><div class="line">Verify the connector<span class="string">'s configuration, identify and stop any process that'</span>s listening on port <span class="number">8080</span>, or configure <span class="keyword">this</span> application to listen on another port.</div></pre></td></tr></table></figure>
<pre><code>以下是springboot提供的几个常用的FailureAnalyzer列表：
</code></pre><ul>
<li>PortInUseFailureAnalyzer</li>
<li>NoUniqueBeanDefinitionFailureAnalyzer</li>
<li>BeanCurrentlyInCreationFailureAnalyzer<pre><code>你可以通过查看springboot的org.springframework.boot.diagnostics包找到完整的FailureAnalyzer列表。
springboot提供了一种简单的方法来创建我们自己的自定义FailureAnalyzer。
</code></pre><h5 id="1-创建自定义FailureAnalyzer"><a href="#1-创建自定义FailureAnalyzer" class="headerlink" title="1.创建自定义FailureAnalyzer"></a>1.创建自定义FailureAnalyzer</h5><pre><code>为了创建我们自己的自定义FailureAnalyzer，我们可以使用AbstractFailureAnalyzer作为方便的扩展点，
</code></pre>  AbstractFailureAnalyzer将检查是否存在指定的异常，并允许我们的自定义分析器处理它。<pre><code>我们在springboot应用中为下述用例创建一个自定义FailureAnalyze：
</code></pre></li>
<li>尝试为给定的依赖注入一个不同的bean</li>
<li><p>当我们尝试注入它时，Spring将抛出BeanNotOfRequiredTypeException异常，因为我们正在尝试注入不同的bean</p>
<pre><code>下面试简单的FailureAnalyzer代码：
</code></pre><figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">CustomFailureAnalyzer</span> <span class="keyword">extends</span> <span class="title">AbstractFailureAnalyzer</span>&lt;<span class="title">BeanNotOfRequiredTypeException</span>&gt; </span>&#123;</div><div class="line">    <span class="comment">/**</span></div><div class="line"></div><div class="line">     * Returns an analysis of the given &#123;<span class="doctag">@code</span> failure&#125;, or &#123;<span class="doctag">@code</span> null&#125; if no analysis</div><div class="line"></div><div class="line">     * was possible.</div><div class="line"></div><div class="line">     *</div><div class="line"></div><div class="line">     * <span class="doctag">@param</span> rootFailure the root failure passed to the analyzer</div><div class="line"></div><div class="line">     * <span class="doctag">@param</span> cause       the actual found cause</div><div class="line"></div><div class="line">     * <span class="doctag">@return</span> the analysis or &#123;<span class="doctag">@code</span> null&#125;</div><div class="line"></div><div class="line">     */</div><div class="line"></div><div class="line">    <span class="meta">@Override</span></div><div class="line">    <span class="function"><span class="keyword">protected</span> FailureAnalysis <span class="title">analyze</span><span class="params">(Throwable rootFailure, BeanNotOfRequiredTypeException cause)</span> </span>&#123;</div><div class="line"></div><div class="line">        String message =<span class="string">"####################### This is a custom fail Message ################ %n"</span>+</div><div class="line"></div><div class="line">                getDescription(cause);</div><div class="line"></div><div class="line">        <span class="keyword">return</span> <span class="keyword">new</span> FailureAnalysis(message , (String)<span class="keyword">null</span>, cause);</div><div class="line"></div><div class="line">    &#125;</div><div class="line">    <span class="function"><span class="keyword">private</span> String <span class="title">getDescription</span><span class="params">(BeanNotOfRequiredTypeException ex)</span> </span>&#123;</div><div class="line">        StringWriter description = <span class="keyword">new</span> StringWriter();</div><div class="line"></div><div class="line">        PrintWriter printer = <span class="keyword">new</span> PrintWriter(description);</div><div class="line"></div><div class="line">        printer.printf(</div><div class="line"></div><div class="line">                <span class="string">"The bean %s could not be injected"</span></div><div class="line"></div><div class="line">                        + <span class="string">"due to %s"</span>,</div><div class="line"></div><div class="line">                ex.getBeanName(), ex.getRequiredType().getName());</div><div class="line"></div><div class="line">        <span class="keyword">return</span> description.toString();</div><div class="line">    &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<pre><code>重点在于analyze()方法，它将被触发，springboot将传递一个Throwable对象以及用例（也就是Spring抛出的异常）。
</code></pre><h5 id="2-注册自定义FailureAnalyzer"><a href="#2-注册自定义FailureAnalyzer" class="headerlink" title="2.注册自定义FailureAnalyzer"></a>2.注册自定义FailureAnalyzer</h5><pre><code>我们需要一种特殊的方法来用springboot注册自定义FailureAnalyzer，以便springboot能够在系统引发异常的情况下
</code></pre><p>  调用自定义FailureAnalyzer，需要使用META-INF文件夹中的spring.factories属性文件来注册它。</p>
<pre><code>如果META-INF文目录或者spring.factories文件不存在，需要手动创建，若要注册自定义FailureAnalyzer，在spring.factories中
</code></pre><p>  添加以下条目：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">org.springframework.boot.diagnostics.FailureAnalyzer=\</div><div class="line">  com.umeshawasthi.failureanalyzer.CustomFailureAnalyzer</div></pre></td></tr></table></figure>
<pre><code>如果有多个FailureAnalyzer，您可以使用逗号分隔将其注册为多个条目：
</code></pre><figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">org.springframework.boot.diagnostics.FailureAnalyzer=\</div><div class="line">com.umeshawasthi.failureanalyzer.CustomFailureAnalyzer,\ com.umeshawasthi.failureanalyzer.CustomFailureAnalyzer1</div></pre></td></tr></table></figure>
<pre><code>到这里，我们设置了所有的自定义FailureAnalyzer并且可以测试了。
</code></pre><h5 id="3-FailureAnalyzer实际应用"><a href="#3-FailureAnalyzer实际应用" class="headerlink" title="3.FailureAnalyzer实际应用"></a>3.FailureAnalyzer实际应用</h5><pre><code>我在示例中创建了2个类，内容如下：
</code></pre><figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">AdminDAO</span> </span>&#123;</div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">helloAdmin</span><span class="params">()</span></span>&#123;</div><div class="line">        System.out.println(<span class="string">"Hello Admin"</span>);</div><div class="line">    &#125;</div><div class="line">&#125;</div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"><span class="meta">@Repository</span>(<span class="string">"adminDAO"</span>)</div><div class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">AdminDAOImpl</span> </span>&#123;</div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setupAdmin</span><span class="params">()</span></span>&#123;</div><div class="line">        <span class="comment">//default implimentation</span></div><div class="line">    &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<pre><code>创建一个控制器，并且将AdminDAO以adminDAO属性注入进去：
</code></pre><figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line"><span class="meta">@RestController</span></div><div class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">HelloWorldController</span> </span>&#123;</div><div class="line">   <span class="meta">@Resource</span>(name = <span class="string">"adminDAO"</span>)</div><div class="line">   <span class="keyword">private</span> AdminDAO adminDAO;</div><div class="line">   <span class="comment">//some methods</span></div><div class="line">&#125;</div></pre></td></tr></table></figure>
<pre><code>如果运行springboot应用程序    ，Spring将尝试在AdminDAO中注入AdminDAOImpl类型的adminDao，因为类型不兼容，Spring将
</code></pre><p>  抛出BeanNotOfRequiredTypeException，在当前用例中，springboot将检查并确定注册了一个有效的FailureAnalyzer，并将信息<br>  传递给注册的FailureAnalyzer。  </p>
<pre><code>在我们的例子中，我们已经注册了CustomFailureAnalyzer来处理这种情况，springboot将把这个信息传递给我们的自定义
</code></pre><p>  FailureAnalyzer以产生更加友好的消息。 </p>
<pre><code>这是我们运行应用程序时的输出：
</code></pre><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">***************************</div><div class="line"></div><div class="line">APPLICATION FAILED TO START</div><div class="line"></div><div class="line">***************************</div><div class="line">Description:</div><div class="line">################# This is a custom fail Message ################ %nThe bean adminDAO could not be injecteddue to com.umeshawasthi.service.AdminDAO</div></pre></td></tr></table></figure>
</li>
</ul>
<h5 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h5><pre><code>    在本文中，我们探究了springboot提供的一个有趣的特性，我们看到了springboot FailureAnalyzer的工作原理以及如何
创建我们自己的自定义FailureAnalyzer。
</code></pre>  
	</div>
		<footer class="article-footer clearfix">
<div class="article-catetags">

<div class="article-categories">
  <span></span>
  <a class="article-category-link" href="/typhoon/categories/springboot/">springboot</a>
</div>


  <div class="article-tags">
  
  <span></span> <a href="/typhoon/tags/springboot/">springboot</a>
  </div>

</div>



	<div class="article-share" id="share">
	
	  <div data-url="http://scorpioaeolus.oschina.io/2018/11/24/springboot之FailureAnalyzer/" data-title="springboot之FailureAnalyzer | Typhoon&#39;s code space" data-tsina="null" class="share clearfix">
	  </div>
	
	</div>


</footer>

   	       
	</article>
	
<nav class="article-nav clearfix">
 
 <div class="prev" >
 <a href="/typhoon/2018/11/24/什么是springboot/" title="什么是springboot">
  <strong>上一篇：</strong><br/>
  <span>
  什么是springboot</span>
</a>
</div>


<div class="next">
<a href="/typhoon/2018/11/24/springboot之CommandLineRunner接口/"  title="springboot之CommandLineRunner接口">
 <strong>下一篇：</strong><br/> 
 <span>springboot之CommandLineRunner接口
</span>
</a>
</div>

</nav>

	


</div>  
      <div class="openaside"><a class="navbutton" href="#" title="Show Sidebar"></a></div>

  <div id="toc" class="toc-aside">
  <strong class="toc-title">Contents</strong>
 
 <ol class="toc"><li class="toc-item toc-level-5"><a class="toc-link" href="#介绍"><span class="toc-number">1.</span> <span class="toc-text">介绍</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#1-创建自定义FailureAnalyzer"><span class="toc-number">2.</span> <span class="toc-text">1.创建自定义FailureAnalyzer</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#2-注册自定义FailureAnalyzer"><span class="toc-number">3.</span> <span class="toc-text">2.注册自定义FailureAnalyzer</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#3-FailureAnalyzer实际应用"><span class="toc-number">4.</span> <span class="toc-text">3.FailureAnalyzer实际应用</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#总结"><span class="toc-number">5.</span> <span class="toc-text">总结</span></a></li></ol>
 
  </div>

<div id="asidepart">
<div class="closeaside"><a class="closebutton" href="#" title="Hide Sidebar"></a></div>
<aside class="clearfix">

  


  
<div class="categorieslist">
	<p class="asidetitle">Categories</p>
		<ul>
		
		  
			<li><a href="/typhoon/categories/dubbo/" title="dubbo">dubbo<sup>8</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/java性能优化/" title="java性能优化">java性能优化<sup>17</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/java源码分析/" title="java源码分析">java源码分析<sup>1</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/motan/" title="motan">motan<sup>2</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/spring/" title="spring">spring<sup>11</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/springboot/" title="springboot">springboot<sup>28</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/springmvc/" title="springmvc">springmvc<sup>1</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/容器/" title="容器">容器<sup>1</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/工具/" title="工具">工具<sup>7</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/性能优化/" title="性能优化">性能优化<sup>5</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/架构/" title="架构">架构<sup>8</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/案例分析/" title="案例分析">案例分析<sup>13</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/缓存/" title="缓存">缓存<sup>4</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/设计模式/" title="设计模式">设计模式<sup>3</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/面试题/" title="面试题">面试题<sup>1</sup></a></li>
		  
		
		</ul>
</div>


  
<div class="tagslist">
	<p class="asidetitle">Tags</p>
		<ul class="clearfix">
		
			
				<li><a href="/typhoon/tags/springboot/" title="springboot">springboot<sup>28</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/java性能优化/" title="java性能优化">java性能优化<sup>9</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/限流/" title="限流">限流<sup>3</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/Spring5/" title="Spring5">Spring5<sup>3</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/设计模式/" title="设计模式">设计模式<sup>3</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/案例分析/" title="案例分析">案例分析<sup>2</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/性能优化/" title="性能优化">性能优化<sup>2</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/Spring/" title="Spring">Spring<sup>2</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/dubbo/" title="dubbo">dubbo<sup>2</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/分页/" title="分页">分页<sup>2</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/并发/" title="并发">并发<sup>2</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/异常拦截/" title="异常拦截">异常拦截<sup>1</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/dubbo分布式事务/" title="dubbo分布式事务">dubbo分布式事务<sup>1</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/自带图片/" title="自带图片">自带图片<sup>1</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/svn导出mvn项目/" title="svn导出mvn项目">svn导出mvn项目<sup>1</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/dubbo过滤器/" title="dubbo过滤器">dubbo过滤器<sup>1</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/排序性能对比/" title="排序性能对比">排序性能对比<sup>1</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/ListenableFuture/" title="ListenableFuture">ListenableFuture<sup>1</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/PropertyChangeListener/" title="PropertyChangeListener">PropertyChangeListener<sup>1</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/jdbcTemplate高可用/" title="jdbcTemplate高可用">jdbcTemplate高可用<sup>1</sup></a></li>
			
		
		</ul>
</div>


  <div class="linkslist">
  <p class="asidetitle">Links</p>
    <ul>
        
          <li>
            
            	<a href="https://coderq.com" target="_blank" title="一个面向程序员交流分享的新一代社区">码农圈</a>
            
          </li>
        
          <li>
            
            	<a href="http://wuchong.me" target="_blank" title="Jark&#39;s Blog">Jark&#39;s Blog</a>
            
          </li>
        
    </ul>
</div>

  


  <div class="rsspart">
	<a href="/atom.xml" target="_blank" title="rss">RSS</a>
</div>

  <div class="weiboshow">
  <p class="asidetitle">Weibo</p>
    <iframe width="100%" height="119" class="share_self"  frameborder="0" scrolling="no" src="http://widget.weibo.com/weiboshow/index.php?language=&width=0&height=119&fansRow=2&ptype=1&speed=0&skin=9&isTitle=1&noborder=1&isWeibo=0&isFans=0&uid=null&verifier=b3593ceb&dpc=1"></iframe>
</div>


</aside>
</div>
    </div>
    <footer><div id="footer" >
	
	<div class="line">
		<span></span>
		<div class="author"></div>
	</div>
	
	
	<section class="info">
		<p> Hello ,I&#39;m a java coder. <br/>
			This is my blog,believe it or not.</p>
	</section>
	 
	<div class="social-font" class="clearfix">
		
		
		
		
		
		
		
		
		
		
		<a href="mailto:ScorpioAeolus@163.com" target="_blank" class="icon-email" title="Email Me"></a>
		
	</div>
			
		

		<p class="copyright">
		Powered by <a href="http://hexo.io" target="_blank" title="hexo">hexo</a> and Theme by <a href="https://github.com/wuchong/jacman" target="_blank" title="Jacman">Jacman</a> © 2019 
		
		<a href="/typhoon/about" target="_blank" title="typhoon">typhoon</a>
		
		
		</p>
</div>
</footer>
    <script src="/typhoon/js/jquery-2.0.3.min.js"></script>
<script src="/typhoon/js/jquery.imagesloaded.min.js"></script>
<script src="/typhoon/js/gallery.js"></script>
<script src="/typhoon/js/jquery.qrcode-0.12.0.min.js"></script>

<script type="text/javascript">
$(document).ready(function(){ 
  $('.navbar').click(function(){
    $('header nav').toggleClass('shownav');
  });
  var myWidth = 0;
  function getSize(){
    if( typeof( window.innerWidth ) == 'number' ) {
      myWidth = window.innerWidth;
    } else if( document.documentElement && document.documentElement.clientWidth) {
      myWidth = document.documentElement.clientWidth;
    };
  };
  var m = $('#main'),
      a = $('#asidepart'),
      c = $('.closeaside'),
      o = $('.openaside');
  c.click(function(){
    a.addClass('fadeOut').css('display', 'none');
    o.css('display', 'block').addClass('fadeIn');
    m.addClass('moveMain');
  });
  o.click(function(){
    o.css('display', 'none').removeClass('beforeFadeIn');
    a.css('display', 'block').removeClass('fadeOut').addClass('fadeIn');      
    m.removeClass('moveMain');
  });
  $(window).scroll(function(){
    o.css("top",Math.max(80,260-$(this).scrollTop()));
  });
  
  $(window).resize(function(){
    getSize(); 
    if (myWidth >= 1024) {
      $('header nav').removeClass('shownav');
    }else{
      m.removeClass('moveMain');
      a.css('display', 'block').removeClass('fadeOut');
      o.css('display', 'none');
      
      $('#toc.toc-aside').css('display', 'none');
        
    }
  });
});
</script>

<script type="text/javascript">
$(document).ready(function(){ 
  var ai = $('.article-content>iframe'),
      ae = $('.article-content>embed'),
      t  = $('#toc'),
      ta = $('#toc.toc-aside'),
      o  = $('.openaside'),
      c  = $('.closeaside');
  if(ai.length>0){
    ai.wrap('<div class="video-container" />');
  };
  if(ae.length>0){
   ae.wrap('<div class="video-container" />');
  };
  c.click(function(){
    ta.css('display', 'block').addClass('fadeIn');
  });
  o.click(function(){
    ta.css('display', 'none');
  });
  $(window).scroll(function(){
    ta.css("top",Math.max(140,320-$(this).scrollTop()));
  });
});
</script>


<script type="text/javascript">
$(document).ready(function(){ 
  var $this = $('.share'),
      url = $this.attr('data-url'),
      encodedUrl = encodeURIComponent(url),
      title = $this.attr('data-title'),
      tsina = $this.attr('data-tsina'),
      description = $this.attr('description');
  var html = [
  '<div class="hoverqrcode clearfix"></div>',
  '<a class="overlay" id="qrcode"></a>',
  '<a href="https://www.facebook.com/sharer.php?u=' + encodedUrl + '" class="article-share-facebook" target="_blank" title="Facebook"></a>',
  '<a href="https://twitter.com/intent/tweet?url=' + encodedUrl + '" class="article-share-twitter" target="_blank" title="Twitter"></a>',
  '<a href="#qrcode" class="article-share-qrcode" title="微信"></a>',
  '<a href="http://widget.renren.com/dialog/share?resourceUrl=' + encodedUrl + '&srcUrl=' + encodedUrl + '&title=' + title +'" class="article-share-renren" target="_blank" title="人人"></a>',
  '<a href="http://service.weibo.com/share/share.php?title='+title+'&url='+encodedUrl +'&ralateUid='+ tsina +'&searchPic=true&style=number' +'" class="article-share-weibo" target="_blank" title="微博"></a>',
  '<span title="Share to"></span>'
  ].join('');
  $this.append(html);

  $('.hoverqrcode').hide();

  var myWidth = 0;
  function updatehoverqrcode(){
    if( typeof( window.innerWidth ) == 'number' ) {
      myWidth = window.innerWidth;
    } else if( document.documentElement && document.documentElement.clientWidth) {
      myWidth = document.documentElement.clientWidth;
    };
    var qrsize = myWidth > 1024 ? 200:100;
    var options = {render: 'image', size: qrsize, fill: '#2ca6cb', text: url, radius: 0.5, quiet: 1};
    var p = $('.article-share-qrcode').position();
    $('.hoverqrcode').empty().css('width', qrsize).css('height', qrsize)
                          .css('left', p.left-qrsize/2+20).css('top', p.top-qrsize-10)
                          .qrcode(options);
  };
  $(window).resize(function(){
    $('.hoverqrcode').hide();
  });
  $('.article-share-qrcode').click(function(){
    updatehoverqrcode();
    $('.hoverqrcode').toggle();
  });
  $('.article-share-qrcode').hover(function(){}, function(){
      $('.hoverqrcode').hide();
  });
});   
</script>









<link rel="stylesheet" href="/typhoon/fancybox/jquery.fancybox.css" media="screen" type="text/css">
<script src="/typhoon/fancybox/jquery.fancybox.pack.js"></script>
<script type="text/javascript">
$(document).ready(function(){ 
  $('.article-content').each(function(i){
    $(this).find('img').each(function(){
      if ($(this).parent().hasClass('fancybox')) return;
      var alt = this.alt;
      if (alt) $(this).after('<span class="caption">' + alt + '</span>');
      $(this).wrap('<a href="' + this.src + '" title="' + alt + '" class="fancybox"></a>');
    });
    $(this).find('.fancybox').each(function(){
      $(this).attr('rel', 'article' + i);
    });
  });
  if($.fancybox){
    $('.fancybox').fancybox();
  }
}); 
</script>



<!-- Analytics Begin -->



<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "//hm.baidu.com/hm.js?e6d1f421bbc9962127a50488f9ed37d1";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>



<!-- Analytics End -->

<!-- Totop Begin -->

	<div id="totop">
	<a title="Back to Top"><img src="/typhoon/img/scrollup.png"/></a>
	</div>
	<script src="/typhoon/js/totop.js"></script>

<!-- Totop End -->

<!-- MathJax Begin -->
<!-- mathjax config similar to math.stackexchange -->


<!-- MathJax End -->

<!-- Tiny_search Begin -->

<!-- Tiny_search End -->

  </body>
</html>
